#Boa:Frame:pacienteFrame

import wx
from BancoDeDados import BancoDeDados
from Paciente import *
bd = BancoDeDados()
print bd.lista_pacientes

def create(parent):
    return pacienteFrame(parent)

[wxID_PACIENTEFRAME, wxID_PACIENTEFRAMEALTERAR, wxID_PACIENTEFRAMEBUTTON1, 
 wxID_PACIENTEFRAMEBUTTON2, wxID_PACIENTEFRAMECELULAR, wxID_PACIENTEFRAMECEP, 
 wxID_PACIENTEFRAMECIDADE, wxID_PACIENTEFRAMECONTROLE, 
 wxID_PACIENTEFRAMECONVENIO, wxID_PACIENTEFRAMECPF, wxID_PACIENTEFRAMEEMAIL, 
 wxID_PACIENTEFRAMEESPBAIRRO, wxID_PACIENTEFRAMEESPCELULAR, 
 wxID_PACIENTEFRAMEESPCEP, wxID_PACIENTEFRAMEESPCIDADE, 
 wxID_PACIENTEFRAMEESPCONVENIO, wxID_PACIENTEFRAMEESPCPF, 
 wxID_PACIENTEFRAMEESPEMAIL, wxID_PACIENTEFRAMEESPESTADO, 
 wxID_PACIENTEFRAMEESPNOME, wxID_PACIENTEFRAMEESPNUMERO, 
 wxID_PACIENTEFRAMEESPPESQUISACPF, wxID_PACIENTEFRAMEESPPESQUISANOME, 
 wxID_PACIENTEFRAMEESPRESULTADOPESQUISACPF, 
 wxID_PACIENTEFRAMEESPRESULTADOPESQUISANOME, wxID_PACIENTEFRAMEESPRUA, 
 wxID_PACIENTEFRAMEESPSEXO, wxID_PACIENTEFRAMEESPTELEFONE, 
 wxID_PACIENTEFRAMEEXCLUIR, wxID_PACIENTEFRAMENOME, wxID_PACIENTEFRAMENOME2, 
 wxID_PACIENTEFRAMEPACIENTE, wxID_PACIENTEFRAMEPANEL1, 
 wxID_PACIENTEFRAMEPANEL2, wxID_PACIENTEFRAMEPANEL3, 
 wxID_PACIENTEFRAMEPESQUISA, wxID_PACIENTEFRAMEPESQUISAR, 
 wxID_PACIENTEFRAMERESULTADO, wxID_PACIENTEFRAMESALVAR, 
 wxID_PACIENTEFRAMESELECIONAR, wxID_PACIENTEFRAMESEXO, 
 wxID_PACIENTEFRAMESTATICBOX1, wxID_PACIENTEFRAMESTATICBOX2, 
 wxID_PACIENTEFRAMESTATICBOX3, wxID_PACIENTEFRAMESTATICTEXT1, 
 wxID_PACIENTEFRAMESTATICTEXT2, wxID_PACIENTEFRAMESTATICTEXT3, 
 wxID_PACIENTEFRAMESTATICTEXT4, wxID_PACIENTEFRAMESTATICTEXT5, 
 wxID_PACIENTEFRAMESTATICTEXT6, wxID_PACIENTEFRAMESTATICTEXT7, 
 wxID_PACIENTEFRAMETEL1, 
] = [wx.NewId() for _init_ctrls in range(52)]

class pacienteFrame(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_PACIENTEFRAME, name='pacienteFrame',
              parent=prnt, pos=wx.Point(504, 222), size=wx.Size(663, 491),
              style=wx.DEFAULT_FRAME_STYLE, title='Paciente')
        self.SetClientSize(wx.Size(647, 453))

        self.panel1 = wx.Panel(id=wxID_PACIENTEFRAMEPANEL1, name='panel1',
              parent=self, pos=wx.Point(0, 0), size=wx.Size(560, 304),
              style=wx.TAB_TRAVERSAL)

        self.paciente = wx.StaticBox(id=wxID_PACIENTEFRAMEPACIENTE,
              label='Dados', name='paciente', parent=self.panel1,
              pos=wx.Point(8, 320), size=wx.Size(560, 320), style=0)
        self.paciente.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.nome = wx.StaticText(id=wxID_PACIENTEFRAMENOME, label='Nome',
              name='nome', parent=self.panel1, pos=wx.Point(16, 336),
              size=wx.Size(33, 16), style=0)
        self.nome.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.cpf = wx.StaticText(id=wxID_PACIENTEFRAMECPF, label='CPF',
              name='cpf', parent=self.panel1, pos=wx.Point(256, 64),
              size=wx.Size(22, 16), style=0)
        self.cpf.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.sexo = wx.StaticText(id=wxID_PACIENTEFRAMESEXO, label='Sexo',
              name='sexo', parent=self.panel1, pos=wx.Point(416, 64),
              size=wx.Size(28, 16), style=0)
        self.sexo.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspNome = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPNOME,
              name=u'EspNome', parent=self.panel1, pos=wx.Point(8, 88),
              size=wx.Size(232, 21), style=0, value=u'')

        self.EspCPF = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPCPF, name=u'EspCPF',
              parent=self.panel1, pos=wx.Point(256, 88), size=wx.Size(136, 21),
              style=0, value=u'')

        self.EspSexo = wx.Choice(choices=['Masculino', 'Feminino'],
              id=wxID_PACIENTEFRAMEESPSEXO, name=u'EspSexo', parent=self.panel1,
              pos=wx.Point(416, 88), size=wx.Size(128, 21), style=0)
        self.EspSexo.SetLabel('')
        self.EspSexo.Bind(wx.EVT_CHOICE, self.OnEspSexoChoice,
              id=wxID_PACIENTEFRAMEESPSEXO)

        self.tel1 = wx.StaticText(id=wxID_PACIENTEFRAMETEL1, label='Telefone',
              name='tel1', parent=self.panel1, pos=wx.Point(8, 120),
              size=wx.Size(51, 16), style=0)
        self.tel1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.celular = wx.StaticText(id=wxID_PACIENTEFRAMECELULAR,
              label='Celular', name='celular', parent=self.panel1,
              pos=wx.Point(104, 120), size=wx.Size(40, 16), style=0)
        self.celular.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspTelefone = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPTELEFONE,
              name=u'EspTelefone', parent=self.panel1, pos=wx.Point(8, 144),
              size=wx.Size(88, 21), style=0, value=u'')

        self.EspCelular = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPCELULAR,
              name=u'EspCelular', parent=self.panel1, pos=wx.Point(104, 144),
              size=wx.Size(88, 21), style=0, value=u'')

        self.email = wx.StaticText(id=wxID_PACIENTEFRAMEEMAIL, label='Email',
              name='email', parent=self.panel1, pos=wx.Point(248, 120),
              size=wx.Size(31, 16), style=0)
        self.email.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspEmail = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPEMAIL,
              name=u'EspEmail', parent=self.panel1, pos=wx.Point(248, 144),
              size=wx.Size(296, 21), style=0, value=u'')

        self.cidade = wx.StaticText(id=wxID_PACIENTEFRAMECIDADE, label='Cidade',
              name='cidade', parent=self.panel1, pos=wx.Point(8, 224),
              size=wx.Size(39, 16), style=0)
        self.cidade.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspRua = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPRUA, name=u'EspRua',
              parent=self.panel1, pos=wx.Point(8, 200), size=wx.Size(288, 24),
              style=0, value=u'')

        self.convenio = wx.StaticText(id=wxID_PACIENTEFRAMECONVENIO,
              label='Conv\xeanio', name='convenio', parent=self.panel1,
              pos=wx.Point(416, 224), size=wx.Size(52, 16), style=0)
        self.convenio.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspBairro = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPBAIRRO,
              name=u'EspBairro', parent=self.panel1, pos=wx.Point(328, 200),
              size=wx.Size(120, 21), style=0, value=u'')

        self.cep = wx.StaticText(id=wxID_PACIENTEFRAMECEP, label='CEP',
              name='cep', parent=self.panel1, pos=wx.Point(144, 224),
              size=wx.Size(22, 16), style=0)
        self.cep.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspNumero = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPNUMERO,
              name=u'EspNumero', parent=self.panel1, pos=wx.Point(488, 200),
              size=wx.Size(56, 21), style=0, value=u'')

        self.staticText2 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT2,
              label='Rua, avenida...', name='staticText2', parent=self.panel1,
              pos=wx.Point(8, 176), size=wx.Size(86, 16), style=0)
        self.staticText2.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.staticText3 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT3,
              label='Bairro', name='staticText3', parent=self.panel1,
              pos=wx.Point(328, 176), size=wx.Size(34, 16), style=0)
        self.staticText3.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.staticText4 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT4,
              label='N\xfamero', name='staticText4', parent=self.panel1,
              pos=wx.Point(488, 176), size=wx.Size(45, 16), style=0)
        self.staticText4.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.EspCidade = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPCIDADE,
              name=u'EspCidade', parent=self.panel1, pos=wx.Point(8, 248),
              size=wx.Size(100, 21), style=0, value=u'')

        self.EspEstado = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPESTADO,
              name=u'EspEstado', parent=self.panel1, pos=wx.Point(272, 248),
              size=wx.Size(100, 21), style=0, value=u'')

        self.EspCEP = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPCEP, name=u'EspCEP',
              parent=self.panel1, pos=wx.Point(144, 248), size=wx.Size(100, 21),
              style=0, value=u'')

        self.staticText1 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT1,
              label='Estado', name='staticText1', parent=self.panel1,
              pos=wx.Point(272, 224), size=wx.Size(38, 16), style=0)
        self.staticText1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.panel2 = wx.Panel(id=wxID_PACIENTEFRAMEPANEL2, name='panel2',
              parent=self, pos=wx.Point(560, 0), size=wx.Size(88, 456),
              style=wx.TAB_TRAVERSAL)

        self.controle = wx.StaticBox(id=wxID_PACIENTEFRAMECONTROLE,
              label='Controle', name='controle', parent=self.panel2,
              pos=wx.Point(0, 0), size=wx.Size(88, 456), style=0)
        self.controle.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.excluir = wx.Button(id=wxID_PACIENTEFRAMEEXCLUIR, label='Excluir',
              name='excluir', parent=self.panel2, pos=wx.Point(8, 240),
              size=wx.Size(75, 23), style=0)
        self.excluir.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))
        self.excluir.Bind(wx.EVT_BUTTON, self.OnExcluirButton,
              id=wxID_PACIENTEFRAMEEXCLUIR)

        self.pesquisar = wx.Button(id=wxID_PACIENTEFRAMEPESQUISAR,
              label='Pesquisar', name='pesquisar', parent=self.panel2,
              pos=wx.Point(8, 336), size=wx.Size(75, 23), style=0)
        self.pesquisar.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))
        self.pesquisar.Bind(wx.EVT_BUTTON, self.OnPesquisarButton,
              id=wxID_PACIENTEFRAMEPESQUISAR)

        self.salvar = wx.Button(id=wxID_PACIENTEFRAMESALVAR, label='Salvar',
              name='salvar', parent=self.panel2, pos=wx.Point(8, 120),
              size=wx.Size(75, 23), style=0)
        self.salvar.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))
        self.salvar.Bind(wx.EVT_BUTTON, self.OnSalvarButton,
              id=wxID_PACIENTEFRAMESALVAR)

        self.panel3 = wx.Panel(id=wxID_PACIENTEFRAMEPANEL3, name='panel3',
              parent=self, pos=wx.Point(0, 304), size=wx.Size(560, 152),
              style=wx.TAB_TRAVERSAL)

        self.staticBox1 = wx.StaticBox(id=wxID_PACIENTEFRAMESTATICBOX1,
              label='Dados', name='staticBox1', parent=self.panel1,
              pos=wx.Point(0, 0), size=wx.Size(560, 320), style=0)
        self.staticBox1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.pesquisa = wx.StaticBox(id=wxID_PACIENTEFRAMEPESQUISA,
              label='Pesquisa', name='pesquisa', parent=self.panel3,
              pos=wx.Point(0, 0), size=wx.Size(560, 72), style=0)
        self.pesquisa.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.staticText5 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT5,
              label='Nome', name='staticText5', parent=self.panel1,
              pos=wx.Point(8, 64), size=wx.Size(33, 16), style=0)
        self.staticText5.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.nome2 = wx.StaticText(id=wxID_PACIENTEFRAMENOME2, label='Nome',
              name='nome2', parent=self.panel3, pos=wx.Point(8, 24),
              size=wx.Size(33, 16), style=0)
        self.nome2.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))

        self.EspPesquisaNome = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPPESQUISANOME,
              name=u'EspPesquisaNome', parent=self.panel3, pos=wx.Point(8, 48),
              size=wx.Size(288, 21), style=0, value=u'')

        self.staticText6 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT6,
              label='CPF', name='staticText6', parent=self.panel3,
              pos=wx.Point(312, 24), size=wx.Size(22, 16), style=0)
        self.staticText6.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.EspResultadoPesquisaCPF = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPRESULTADOPESQUISACPF,
              name=u'EspResultadoPesquisaCPF', parent=self.panel3,
              pos=wx.Point(312, 104), size=wx.Size(100, 21), style=0,
              value=u'')

        self.resultado = wx.StaticBox(id=wxID_PACIENTEFRAMERESULTADO,
              label='Resultado', name='resultado', parent=self.panel3,
              pos=wx.Point(0, 72), size=wx.Size(560, 80), style=0)
        self.resultado.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.EspResultadoPesquisaNome = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPRESULTADOPESQUISANOME,
              name=u'EspResultadoPesquisaNome', parent=self.panel3,
              pos=wx.Point(8, 104), size=wx.Size(280, 21), style=0, value=u'')

        self.EspPesquisaCPF = wx.TextCtrl(id=wxID_PACIENTEFRAMEESPPESQUISACPF,
              name=u'EspPesquisaCPF', parent=self.panel3, pos=wx.Point(312, 48),
              size=wx.Size(100, 21), style=0, value=u'')

        self.button2 = wx.Button(id=wxID_PACIENTEFRAMEBUTTON2, label='Novo',
              name='button2', parent=self.panel2, pos=wx.Point(8, 88),
              size=wx.Size(75, 23), style=0)
        self.button2.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))
        self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button,
              id=wxID_PACIENTEFRAMEBUTTON2)

        self.staticBox2 = wx.StaticBox(id=wxID_PACIENTEFRAMESTATICBOX2,
              label='Controle', name='staticBox2', parent=self.panel2,
              pos=wx.Point(0, 0), size=wx.Size(88, 456), style=0)
        self.staticBox2.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.staticBox3 = wx.StaticBox(id=wxID_PACIENTEFRAMESTATICBOX3,
              label='Controle', name='staticBox3', parent=self.panel2,
              pos=wx.Point(0, 0), size=wx.Size(88, 456), style=0)
        self.staticBox3.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              'Tahoma'))

        self.Button1 = wx.Button(id=wxID_PACIENTEFRAMEBUTTON1, label='Limpar',
              name='Button1', parent=self.panel2, pos=wx.Point(8, 152),
              size=wx.Size(75, 23), style=0)
        self.Button1.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))
        self.Button1.Bind(wx.EVT_BUTTON, self.OnBotaoLimpar,
              id=wxID_PACIENTEFRAMEBUTTON1)

        self.alterar = wx.Button(id=wxID_PACIENTEFRAMEALTERAR, label='Alterar',
              name='alterar', parent=self.panel2, pos=wx.Point(8, 216),
              size=wx.Size(75, 23), style=0)
        self.alterar.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              'Tahoma'))
        self.alterar.Bind(wx.EVT_BUTTON, self.OnAlterarButton,
              id=wxID_PACIENTEFRAMEALTERAR)

        self.staticText7 = wx.StaticText(id=wxID_PACIENTEFRAMESTATICTEXT7,
              label='Conv\xeanio', name='staticText7', parent=self.panel1,
              pos=wx.Point(416, 224), size=wx.Size(52, 16), style=0)
        self.staticText7.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.NORMAL,
              False, 'Tahoma'))

        self.EspConvenio = wx.Choice(choices=bd.get_lista_convenios(),
              id=wxID_PACIENTEFRAMEESPCONVENIO, name=u'EspConvenio',
              parent=self.panel1, pos=wx.Point(416, 248), size=wx.Size(130, 21),
              style=0)

        self.selecionar = wx.Button(id=wxID_PACIENTEFRAMESELECIONAR,
              label='Selecionar', name='selecionar', parent=self.panel2,
              pos=wx.Point(8, 408), size=wx.Size(75, 23), style=0)
        self.selecionar.Bind(wx.EVT_BUTTON, self.OnSelecionarButton,
              id=wxID_PACIENTEFRAMESELECIONAR)

    def __init__(self, parent):
        self._init_ctrls(parent)

    def OnSalvarButton(self, event):
        bd.cadastrar_paciente(self.EspNome.GetValue(),
        self.EspCPF.GetValue(), self.EspSexo.GetLabel(),
        self.EspTelefone.GetValue(), self.EspCelular.GetValue(),
        self.EspRua.GetValue(), self.EspBairro.GetValue(),
        self.EspNumero.GetValue(), self.EspCidade.GetValue(),
        self.EspCEP.GetValue(), self.EspEstado.GetValue(),
        self.EspEmail.GetValue(), self.EspConvenio.GetLabel())

        self.EspNome.SetValue('')
        self.EspCPF.SetValue('')
        self.EspTelefone.SetValue('')
        self.EspCelular.SetValue('')
        self.EspRua.SetValue('')
        self.EspBairro.SetValue('')
        self.EspNumero.SetValue('')
        self.EspCidade.SetValue('')
        self.EspCEP.SetValue('')
        self.EspEstado.SetValue('')
        self.EspEmail.SetValue('')
        
    def OnButton2Button(self, event):
        self.EspNome.SetValue('')
        self.EspCPF.SetValue('')
        self.EspTelefone.SetValue('')
        self.EspCelular.SetValue('')
        self.EspRua.SetValue('')
        self.EspBairro.SetValue('')
        self.EspNumero.SetValue('')
        self.EspCidade.SetValue('')
        self.EspCEP.SetValue('')
        self.EspEstado.SetValue('')
        self.EspEmail.SetValue('')

    def OnEspSexoChoice(self, event):
        event.Skip()

    def OnBotaoLimpar(self, event):
        self.EspNome.SetValue('')
        self.EspCPF.SetValue('')
        self.EspTelefone.SetValue('')
        self.EspCelular.SetValue('')
        self.EspRua.SetValue('')
        self.EspBairro.SetValue('')
        self.EspNumero.SetValue('')
        self.EspCidade.SetValue('')
        self.EspCEP.SetValue('')
        self.EspEstado.SetValue('')
        self.EspEmail.SetValue('')

    def OnPesquisarButton(self, event):
        if self.EspPesquisaNome.GetValue() != '':
            bd.paciente_retornar(self.EspPesquisaNome.GetValue(), 'nome')
            self.EspResultadoPesquisaNome.SetValue(bd.get_pesquisa_nome())
            self.EspResultadoPesquisaCPF.SetValue(bd.get_pesquisa_CPF())
        if self.EspPesquisaCPF.GetValue() != '':
            bd.paciente_retornar(self.EspPesquisaCPF.GetValue(), 'cpf')
            self.EspResultadoPesquisaCPF.SetValue(bd.get_pesquisa_CPF())
            self.EspResultadoPesquisaNome.SetValue(bd.get_pesquisa_nome())

    def OnExcluirButton(self, event):
        bd.consultar_paciente()

    def OnAlterarButton(self, event):

        
        self.paciente_selecionado.set_nome(self.EspNome.GetValue())
        self.paciente_selecionado.set_cpf(self.EspCPF.GetValue())
        self.paciente_selecionado.set_sexo(self.EspSexo.GetLabel())
        self.paciente_selecionado.set_telefone(self.EspTelefone.GetValue())
        self.paciente_selecionado.set_celular(self.EspCelular.GetValue())
        self.paciente_selecionado.set_email(self.EspEmail.GetValue())
        self.paciente_selecionado.set_rua(self.EspRua.GetValue())
        self.paciente_selecionado.set_bairro(self.EspBairro.GetValue())
        self.paciente_selecionado.set_numero(self.EspNumero.GetValue())
        self.paciente_selecionado.set_cidade(self.EspCidade.GetValue())
        self.paciente_selecionado.set_cep(self.EspCEP.GetValue())
        self.paciente_selecionado.set_estado(self.EspEstado.GetValue())
        
        bd.altera_paciente(self.paciente_selecionado)

        
        
    def OnSelecionarButton(self, event):
        bd.pesquisa_CPF(self.EspResultadoPesquisaCPF.GetValue())
        self.paciente_selecionado = bd.get_paciente_selecionado()
        
        self.EspNome.SetValue(self.paciente_selecionado.get_nome())
        self.EspCPF.SetValue(self.paciente_selecionado.get_cpf())
        self.EspTelefone.SetValue(self.paciente_selecionado.get_telefone())
        self.EspCelular.SetValue(self.paciente_selecionado.get_celular())
        self.EspRua.SetValue(self.paciente_selecionado.get_rua())
        self.EspBairro.SetValue(self.paciente_selecionado.get_bairro())
        self.EspNumero.SetValue(self.paciente_selecionado.get_numero())
        self.EspCidade.SetValue(self.paciente_selecionado.get_cidade())
        self.EspCEP.SetValue(self.paciente_selecionado.get_cep())
        self.EspEstado.SetValue(self.paciente_selecionado.get_estado())
        self.EspEmail.SetValue(self.paciente_selecionado.get_email()) 
